<template>
  <page-wrap back hide-tab title="我的报告" stay-still>
    <view v-if="reportList.length" style="margin: 0 auto 44rpx">
      <reportItem v-for="item in reportList" :key="item" :isPreview="isPreview" :isPC="isPC" :reportItem="item" />
    </view>
    <view v-else style="margin: auto">
      <image src="https://upload.yl1001.com/upload/images/view?file=4OfTf3BRA6yiNIFpeICLZf95XWKoO6VigbriGCezAfOvCn4KGx2nN=Cl98WTe.png" style="width: 400rpx; height: 400rpx" />
    </view>
  </page-wrap>
</template>

<script>
import reportItem from "@/components/reportItem/index.vue";
import { getBuyReport } from "@/api/modules/report";
export default {
  components: {
    reportItem,
  },
  data() {
    return {
      isPreview: false,
      personId: "",
      reportList: [],
      isPC: false,
    };
  },
  created() {
    this.personId = uni.getStorageSync("person-id").slice(2) || undefined;
    this.getReportList();
  },
  onLoad() {
    uni.getSystemInfo({
      success: (res) => {
        // console.log(res)
        if (res.system.toLowerCase().includes('windows') || res.system.toLowerCase().includes('macos') || res.model.toLowerCase().includes("mac")) {
          this.isPC = true
        }
      },
    })
  },
  methods: {
    // 获取报告
    getReportList() {
      let param = {
        orderCompanyId: this.personId,
        orderUserId: this.personId,
        // orderCompanyId:19587557,
        // orderUserId:19587557,
        moduleType: "OCCUPATION_MODULE_TYPE",
        buyStatus: 1,
        pageNo: 0,
        pageSize: 10,
      };
      getBuyReport(param, this.personId)
        .then((res) => {
          if (res.code == 200) {
            // console.log(res);
            this.reportList = res.data;
          }
        })
        .finally(() => {
          this.loading = false;
        });
    },
  },
};
</script>

<style>
</style>
